package com.example.swim.Service;

import com.example.swim.Dao.CardMapper;
import com.example.swim.Pojo.Card;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author LiYa
 * @create 2022-11-23 21:07
 */
@Transactional
@Service
public class CardService {
    @Autowired
    CardMapper cardMapper;
    @Cacheable(value = "allCard",key = "'cards'")
    public List<Card> find(){
        return cardMapper.selectList(null);
    }
    @Cacheable(value = "allCard",key="#p0")
    public Card findById(int id)
    {
        return cardMapper.selectById(id);
    }
}
